<?
//error_reporting(E_ALL);ini_set('display_errors',1);

include_once ("../modconfig.php");
include_once ("$ROOT_CLASS_DIR/tbs_class.php");
include_once ("$ROOT_CLASS_DIR/class_database.php");
include_once ("$ROOT_CLASS_DIR/class_common.php");
include_once ("$ROOT_CLASS_DIR/class_login.php");
include_once ("$ROOT_CLASS_DIR/class_pdf.php");
//Swither Page;


//initiate Vars
define("PRIMARY_KEY","nobkt");
$PRIMARY_KEY    = PRIMARY_KEY;
$PRIMARY_VALUE  = GetParam($PRIMARY_KEY,"");
$FileName       = "ais_transaction_dn.php";
$FileTemplate   = "ais_transaction_dn_form.html";
$SubHeaderTitle = "Transaction Account Receivable - Debit Note";
$TableName      = "ais_memorial";
$HTMLFormName   = "DNSummaryForm";
$MaxGrid        = "100";
$KTRASL         = GetOfficeID();

$SQLGrid = "SELECT * FROM ais_memorial "."WHERE ".PRIMARY_KEY." ='".GetParam(PRIMARY_KEY,"")."' AND ktrasl='".GetOfficeID()."' AND urut<>999 ORDER BY urut";



$location = GetParam("location","");
$container_size = GetParam("container_size","");
$tariffpack = GetParam("tariffpack","");
$qty = GetParam("qty","");
$SessionVar = GetParam("SessionVar","");


$SQL = "SELECT * FROM tbltariffheader as a 
        JOIN tbltariffdetail as b on a.id = b.tbltariffheader_id 
        JOIN tblreceipt as c on b.tblreceipt_id = c.kdreceipt 
        WHERE a.id = '".$tariffpack."' ORDER by a.id ASC";


$row = $DBConnection->dbc->get_results($SQL);


?>

<? if(!empty($row)){ 

	?>

<script type="text/javascript" src="<? echo $ROOT_DIR; ?>js/jsinit.php?session=<? echo $SessionVar; ?>"></script>

<table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">

	<? foreach($row as $it => $val) { 
	   
	       $total = intval($val->rate) * $qty;
	   	
	?>
      
        
		
	  <tr id="1">
			
			<td nowrap class="FacetDataTD" align="center" width="35">
			    &nbsp;
			    <input type="hidden" name="memorial_id<?= $it+1; ?>" value="" maxlength="255" size="25" class="memorial_id_resp">
			</td>
			<td nowrap class="FacetDataTD" align="right" width="50" align="right">
				<?= $it+1; ?>
				<input type="hidden" name="urut<?= $it+1; ?>" value="<?= $it+1; ?>" class="urut_resp">
			</td>
			<td nowrap class="FacetDataTD"  width="180" align="center">
				<input type="text" name="uraian<?= $it+1; ?>" value="<? echo $val->receiptname; ?>" maxlength="255" size="35" class="uraian_resp">		  
			</td>
			<td nowrap class="FacetDataTD" width="120" align="center">
				<input type="text" class="jumlah_resp" name="jumlah<?= $it+1; ?>" value="<?= number_format($total, 2, '.', ','); ?>" maxlength="255" size="22" onKeyUp="document.[var.HTMLFormName].total_trans.value = SumTotal('jumlah')">
				<input type="hidden" class="amount_hdn" value="<?= $total; ?>" maxlength="255" size="22" class="inputnumber" onKeyUp="document.[var.HTMLFormName].total_trans.value = SumTotal('jumlah')">
			</td>
			
			<td class="FacetDataTD" width="125" align="center">
				<input type="text" class="skada_resp" name="skada<?= $it+1; ?>" value="<?= $val->coa; ?>" maxlength="255" size="20" onKeyUp="this.blur();openSkada(1);" onClick="this.blur();openSkada(1);">
			</td>
			
			<td class="FacetDataTD" width="135" align="center">
				<input type="text" class="noorder_resp" name="noorder<?= $it+1; ?>" value="" maxlength="255" size="15" onChange="this.value=this.value.toUpperCase()">
			</td>
			<td class="FacetDataTD" width="110" align="center">
				<input type="text" class="noref_resp" name="noref<?= $it+1; ?>" value="" maxlength="255" size="10" onChange="this.value=this.value.toUpperCase()">
			</td>
			<td class="FacetDataTD" width="50" align="center">
						  <select name="kdact<?= $it+1; ?>" class="kdact_resp">
										<option value="">-</option>
										<option value="[actblk.kdact]">[actblk.kdact;block=option]</option>
										<option>[blg.kdact;selected;noerr]</option>
						  </select>
			</td>
			<td class="FacetDataTD" width="10" align="center">
				 <a href="javascript:OpenRemark(1);"><img src="../../images/new.gif" align="middle" border=0></a>
				 <input type="hidden" name="uraian_a1" value="">
				 <input type="hidden" name="uraian_b1" value="">
				 <input type="hidden" name="uraian_c1" value="">
				 <input type="hidden" name="uraian_d1" value="">
			</td>
			
		</tr>

	<? } //END Foreach?>
        
</table>

<input type="hidden" id="row_resp" value="<? echo count($row); ?>">

<? 



} //End If 

else { echo "NO DATA"; }//If

?>





                  
